Skip to content

feat: let a site switch off the pieces it does not want, starting with post locks - #724

Merged
josephfusco merged 9 commits into
mainfrom
feat/feature-switches
Oct 5, 2026
Merged

josephfusco merged 9 commits into
mainfrom
feat/feature-switches

Conversation

@josephfusco

@josephfusco josephfusco commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Gutenberg gates its experiments where files load, but #558 put every hook in default-filters.php and avatar-stack.php is shared beyond the admin bar, so this gates hook blocks instead; switching post locks off while someone holds a lock should leave the post looking unlocked until their next lock refresh writes post meta, which I inferred from the code rather than tested.

Only post locks can be switched off for now. Each remaining piece in #710 adds its entry to wp_presence_get_features(), wraps its block in default-filters.php, and adds a test, so a checkbox never appears for something it cannot turn off. With post locks off, the Active Posts widget still runs one lock-priming query per render that nothing reads.

Related: #710

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Reading Gutenberg's experiments code for the pattern, writing the switch, tests and README entry, and running PHPCS and PHPStan locally. Opened as a draft until I've reviewed the diff.

@josephfusco josephfusco added [Type] Enhancement A suggestion for improvement of an existing feature Public API Adds a hook, route, constant, or global that third parties can depend on labels Oct 5, 2026
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

🚩 New public surface

  • (filter) wp_presence_feature_enabled

@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

🛝 WordPress Playgrounds

Built from b4b3e90

Post locks RTC
Single site Launch post locks, single site Launch RTC, single site
Multisite Launch post locks, multisite Launch RTC, multisite

@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props joefusco.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Feature settings leak between tests, and disabling post locks leaves an unnecessary widget query active.

Review effort: Balanced
Findings: 2 Medium severity

Open (2)
What changed in this PR

Adds per-site and multisite feature switches, initially allowing the post-lock bridge to be disabled while retaining core post-meta locking.

Changes:

  • Adds feature configuration, filtering, settings UI, and cleanup.
  • Conditionally registers post-lock hooks.
  • Adds documentation and tests for feature-switch behavior.
File Description
README.md Documents the feature filter and post-lock switch.
plugins/​presence-api/​uninstall.php Removes feature options during uninstall.
plugins/​presence-api/​tests/​test-features.php Tests settings and post-lock switching.
plugins/​presence-api/​presence-api.php Loads feature definitions before hooks.
plugins/​presence-api/​includes/​settings.php Adds site and network feature controls.
plugins/​presence-api/​includes/​features.php Implements feature definitions and state resolution.
plugins/​presence-api/​includes/​default-filters.php Gates post-lock hook registration.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@josephfusco
josephfusco force-pushed the feat/feature-switches branch from ced3c81 to b4b3e90 Compare October 5, 2026 20:06
github-actions Bot added a commit that referenced this pull request Oct 5, 2026
@josephfusco
josephfusco merged commit 1ac34ce into main Oct 5, 2026
6 of 11 checks passed
@josephfusco
josephfusco deleted the feat/feature-switches branch October 5, 2026 20:29
@josephfusco josephfusco added this to the 0.15.0 milestone Oct 5, 2026
josephfusco added a commit that referenced this pull request Oct 8, 2026
* feat: let a site switch off the Active Posts dashboard widget

Add a dashboard-widget feature and gate the Active Posts widget's hooks
behind wp_presence_feature_enabled(), the way #724 did for post locks, so
a site can switch it off on Settings > Presence API. Part of #710.

* fix: put the Active Posts default placement behind the dashboard-widget switch too

* fix: restore the 0.16.1 version the merge rolled back

---------

Co-authored-by: Joe Fusco <josephfusco@users.noreply.github.com>
Co-authored-by: Joe Fusco <hello@josephfus.co>
@josephfusco josephfusco mentioned this pull request Oct 12, 2026
24 of 36 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Public API Adds a hook, route, constant, or global that third parties can depend on [Type] Enhancement A suggestion for improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants